FSI API: General methods for controls
Note | Where these methods change the appearance of a control, they override Properties > Appearance settings in the page designer.
.getById
fsi.getById('<control id>'); Returns the value of the specified control as a string.
Example:
var appCode = fsi.getById('myControlId');
You can also append JavaScript string methods to manipulate the string; for example, this code will remove any leading or trailing spaces:
fsi.getbyId('<control id>').trim();
.setById
fsi.setById('<control id>',<value>); Sets a value for the named control; for example, to display text in a text box.
.hide
fsi.hide('<control id>'); Hides the named control.
.show
fsi.show('<control id>'); Shows the named control.
.disable
fsi.disable('<control id>'); Disables a control; the control appears greyed out. Typically used to disable a button.
.enable
fsi.enable('<control id>'); Enables a control.
.readOnly
fsi.readOnly('<control id>',<isReadOnly {boolean}>; Sets a control to be read only if isReadOnly is true. Hovering over a read only control changes the cursor to .
Example:
fsi.readOnly("textbox-1", true);
.border
fsi.border('<control id>', <width>, <style>, <colour>); Adds a border to the named control.
The value of style follows CSS standards; solid, dotted, dashed, and so on, for example:
fsi.border("textbox-1", "3px", "double", "#0021FF");
.borderRadius
fsi.borderRadius('<control id>', <width>); Sets the border radius in pixels for the named control.
.boxShadow
fsi.boxShadow(<controlName>, <blurRadius>, <color>, <h_length>, <v_length>, <spread>); Adds a box shadow to the named control.
.backColor
fsi.backColor('<control id>', <colour>); For controls that have the Back Color property; this method sets a background colour for the named control overriding the Back Color property. The Back Color property must always be set.
.color
fsi.color('<control id>', <colour>); Sets the text colour displayed by the named control.
.font
fsi.font('<control id>', <fontFamily>, <fontStyle>, <fontWeight>, <fontSize>); Sets font parameters for text displayed in the named control.
Example:
fsi.font('label1', 'Consolas', 'italic', 'normal', '20px');
.height
fsi.height('<control id>', <height>); Sets the height of the named control.
.width
fsi.width(control id, <width>, <units>); Sets the width of the named control. units may be px or %.
.placeholder
fsi.placeholder('<control id>', <placeholder text>); Sets the placeholder text for the named control.
.padding
fsi.padding('<control id>', <padding-top>, <padding-right>, <padding-bottom>, <padding-left>); Sets the padding in pixels around the named control.
.textAlign
fsi.textAlign('<control id>', <text alignment>); Sets the CSS text-align property (left, right, center) for the named control.